let salaries = {
	John: 100,
	Pete: 300,
	Mary: 250,
}

function topSalary(obj = {}) {
	let maxSalary = 0
	let maxName = null

	// Object.entries 将对象转成 键值对 的二维数组形式。
	for (const [name, salary] of Object.entries(obj)) {
		if (salary > maxSalary) {
			maxSalary = salary
			maxName = name
		}
	}

	return maxName
}

console.log(topSalary(salaries)) // Pete
console.log(topSalary()) // null
